﻿package com.neuedu.shop.common;

import java.io.FileWriter;
import java.io.IOException;

/* *
 *类名：AlipayConfig
 *功能：基础配置类
 *详细：设置帐户有关信息及返回路径
 *修改日期：2017-04-05
 *说明：
 *以下代码只是为了方便商户测试而提供的样例代码，商户可以根据自己网站的需要，按照技术文档编写,并非一定要使用该代码。
 *该代码仅供学习和研究支付宝接口使用，只是提供一个参考。
 */

public class AlipayConfig {

//↓↓↓↓↓↓↓↓↓↓请在这里配置您的基本信息↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓

	// 应用ID,您的APPID，收款账号既是您的APPID对应支付宝账号
	public static String APP_ID = "2016101900724832";

	// 商户私钥，您的PKCS8格式RSA2私钥
	public static String APP_PRIVATE_KEY = "MIIEvgIBADANBgkqhkiG9w0BAQEFAASCBKgwggSkAgEAAoIBAQCm8HLMh3bnQQo+2rRnsT7XkX+FpONBebmeZSVE94ax2s3iDVD2E07zfn+EAyPnYPhzJ9ax6XCw+ohd0r7kBYgFc0i1oMCGP0iXlngtGlC2JSQ7A6zbQTEQDc/94uEcAI++tqarQUJS/a7eCe/yg5KpaqkBYQh6Ykih1W4eTUi5UQy3TEYIICXtVFiZJ4+ZMdf5Am+dE8QlCByAySQlKFGov2NlyEG4ng/3bts+APk0rJC1pRRCvxcYxqIW5FvL17mP8ia4udb6t+FX3zroOoPtmFC/NokjcnePcGX7cVtHg2c8M1kLb4qdV09Eg+gGQxK58NoH+iZgo5jTaO6cQj69AgMBAAECggEBAJBWZWuh1JSuD4W44zKkdYk9K90Ja9Q4wtzI5yhyO+ubG1fP26hnmWO+g9JIRMrRdP9b+q1pAR6D/1Pf21yby7eqrbscelmYbdNjLhURI6fZBTJhQxtvilQvHR6PA8OKWL60ffakPgwzevZP8T7ls/D3X5jppMLsJ5CFUOiyOaa/nZepKRhF+EQu9m2s7wRaBCTbB1xHppvnotZ5zMb2Hg+ueuDHar0xTiWulyb0GVbWlS356N63zipsgWPUvtqUkZjj0uvEY/kJHrmu8SzDFXqArwPoG8L/JUusowOz4AxKO3Zkqi3zIQUbUrzXt5oDV2M/Y+NTd94rx5fzYlue4qECgYEA5d1E5qjqcQTfjrEqVW3hL4O68Moe6Wmju9NhIno+mMpKMnN5b0N2HWsLDBRxvXT05qVxpnsFjGbgoqYUl1quoZOU1TVMKcbxZY7qG3Z7+iObDFpg4BnGBrx4CEGwmbYIPEg0z/zpvXkqN+DhFOlq3rUFAikQRI3BHoKCUFm94h8CgYEAueuZkSuaG/EPyy+3tAmETdEfP9SD29YcD7nRh23RhRYPp3+dvgQedoK35FEoTBJ8J6ziZtaBEIWcgIqgQ3N+jX9uJM520menSxZ+mPCfaLqsTN3hjYTfHJk0g4eONiDZgHbd99KlZRW8SkcScy6BTzR9pcOzb7/bZ2V9JJI+G6MCgYB5qFiVNAWQ96FSplXfjR5HxZKlanRd2Tl9aWzZkJWczEPk29UDnFLhUwwvwopIWaRchmfWUvomyzRNIVV4ndgbUD7PcTv0SITu2WrySg1n4HxpV1Q6h6mVWx60UAAl+n/1V8oL4rHbREuh83VtWfTkFi6mbBFeFyCFA1HxMO4cxQKBgQCiwpNM2EvwnCeEbEC5Fv/BFAr0WToaESW9yqGYmtYqWTbZHspcV8THYQZVlYrelewk25/UAYM5kI6CpVlJ02j9vIoTJMA20FFPVeD8SOJ0z78ZB8F2n9Smd6TWZKxlzHo8kVMeqkTq6o1MxU1sklDXow9AN8P1V5NewCU/B9vhWwKBgDGOB4qniiFezIo1k6fR/2IDeR+0BJZggzNSThRGFCKLgEWMBQ8H1vHC5ffK8XZkdx8EPMpKIlIBjc5902jGx2Pw9i8YH+SyBE23y6mgu1QjULXZt83OfIs5TQqySyWPrqeKU/5Plp+NSOPnnxgO9rXCMw1lPxW3dTWG53gJdEyu";

	// 支付宝公钥,查看地址：https://openhome.alipay.com/platform/keyManage.htm 对应APPID下的支付宝公钥。
	public static String ALIPAY_PUBLIC_KEY = "MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEA+oR2Qg9rU4IZdXxpeGUTceMoYEr3Mgs0sbHD37C3e+pieC+HzedmVZ+87NaHbGW5SlINXFmNOPrs5XiMAt2cd1zAb4n4il0S6rm6R/wEmETtI/E2KuxQZyQ/PkSOd63lJ7odzPHqrN6lS9ylhsS9k3FBsz7XrlhTm008MtXNvXzkc+G4EZ+0v8mav5PIkdyhuwRfrO80l2kCesUMeNLC+PaG6YSDaqvBOxhW3gV6Zs5qGGzrBWKzqrYIvRh11LBB0AoiP3fuUKc8QjipTiF3nmh3VBNC03tTgoKfPeVtgc7cBG9JrMgbUZ3tElATqx3aUZCyaPI4E7kNd8WpNJhIuQIDAQAB";

	// 服务器异步通知页面路径 需http://格式的完整路径，不能加?id=123这类自定义参数，必须外网可以正常访问
	public static String notify_url = "http://localhost:8080/tygy-shop/pre/notify_url.jsp";

	// 页面跳转同步通知页面路径 需http://格式的完整路径，不能加?id=123这类自定义参数，必须外网可以正常访问
	public static String return_url = "http://localhost:8080/tygy-shop/pre/return_url.jsp";

	// 签名方式
	public static String sign_type = "RSA2";

	// 字符编码格式
	public static String CHARSET = "utf-8";

	// 支付宝网关
	public static String gatewayUrl = "https://openapi.alipaydev.com/gateway.do";

	// 支付宝网关
	public static String log_path = "E:\\java\\javaExercise\\tygy-shop\\src\\main\\java\\com\\neuedu\\shop\\common";

//↑↑↑↑↑↑↑↑↑↑请在这里配置您的基本信息↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑

	/**
	 * 写日志，方便测试（看网站需求，也可以改成把记录存入数据库）
	 * 
	 * @param sWord 要写入日志里的文本内容
	 */
	public static void logResult(String sWord) {
		FileWriter writer = null;
		try {
			writer = new FileWriter(log_path + "alipay_log_" + System.currentTimeMillis() + ".txt");
			writer.write(sWord);
		} catch (Exception e) {
			e.printStackTrace();
		} finally {
			if (writer != null) {
				try {
					writer.close();
				} catch (IOException e) {
					e.printStackTrace();
				}
			}
		}
	}
}
